//
//  PMBody.h
//  PezMonkey
//
//  Created by Spence DiNicolantonio on 10/28/09.
//  Copyright 2009 Necrosoft. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "PMCore.h"


@interface PMBody : NSObject {
@protected
	// Chipmunk rigid body reference
	cpBody *body;
	
@private
	// User defined data pointer. This pointer should typically be used to 
	// reference the object that the rigid body represents within the engine.
	id data;
}

@property (nonatomic, retain) id data;


#pragma mark -
#pragma mark Init
- (id)initWithMass:(PMFloat)mass Moment:(PMFloat)moment;
+ (PMBody *)staticBody;


#pragma mark -
#pragma mark Getters

// cpBody
- (cpBody *)cpBody;

// Mass
- (PMFloat)mass;
- (PMFloat)massInverse;

// Moment of Inertia
- (PMFloat)moment;
- (PMFloat)momentInverse;

// Linear Properties
- (PMVect)position;
- (PMVect)velocity;
- (PMVect)force;

// Angular Properties
- (PMFloat)angle;
- (PMVect)rotationVector;
- (PMFloat)angularVelocity;
- (PMFloat)torque;


#pragma mark -
#pragma mark Setters

// Mass
- (void)setMass:(PMFloat)mass;

// Moment of Inertia
- (void)setMoment:(PMFloat)moment;

// Linear Properties
- (void)setPosition:(PMVect)position;
- (void)setVelocity:(PMVect)velocity;
- (void)setForce:(PMVect)force;

// Angular Properties
- (void)setAngle:(PMFloat)angle;
- (void)setAngularVelocity:(PMFloat)angularVelocity;
- (void)setTorque:(PMFloat)torque;


#pragma mark -
#pragma mark Force Application

- (void)applyImpulse:(PMVect)impulse;
- (void)applyImpulse:(PMVect)impulse atRelativeOffset:(PMVect)offset;
- (void)applyForce:(PMVect)force;
- (void)applyForce:(PMVect)force atRelativeOffset:(PMVect)offset;
- (void)resetForces;
#pragma mark TO DO: applyDampedSpring:


#pragma mark -
#pragma mark Other Methods

- (void)slewToPoint:(PMVect)point inTime:(PMFloat)deltaT;
- (PMVect)ConvertPointFromLocal:(PMVect)point;
- (PMVect)ConvertPointToLocal:(PMVect)point;


@end
